package top.dark.design.patterns.prototype.mymethod;

/**
 * Author: Darkn
 * description: 普通方式，逻辑简单，但是实现复杂对象时效率低，不灵活
 * Create Time: 2021/4/25 9:53
 */
public class Client {
    public static void main(String[] args) {
        Sheep sheep = new Sheep("001", "小白", 20);
        // 克隆5个一样的小羊
        Sheep sheep1 = new Sheep(sheep.getNo(), sheep.getName(), sheep.getAge());
        Sheep sheep2 = new Sheep(sheep.getNo(), sheep.getName(), sheep.getAge());
        Sheep sheep3 = new Sheep(sheep.getNo(), sheep.getName(), sheep.getAge());
        Sheep sheep4 = new Sheep(sheep.getNo(), sheep.getName(), sheep.getAge());
        Sheep sheep5 = new Sheep(sheep.getNo(), sheep.getName(), sheep.getAge());
        System.out.println("sheep:" + sheep + sheep.hashCode());
        System.out.println("sheep1:" + sheep1 + sheep1.hashCode());
        System.out.println("sheep2:" + sheep2 + sheep2.hashCode());
        System.out.println("sheep3:" + sheep3 + sheep3.hashCode());
        System.out.println("sheep4:" + sheep4 + sheep4.hashCode());
        System.out.println("sheep5:" + sheep5 + sheep5.hashCode());
        System.out.println(sheep == sheep1);
    }
}
